import Taro from '@tarojs/taro';
import { View, Text, Image } from '@tarojs/components';
import PropTypes from 'prop-types';

import './index.scss'

export default class Sunrvey extends  Taro.Component{
    static defaultProps = {
        medicalkit: {},
        renderSolt: '',
        isTop: true,
        fcColor: '',
        isSignin: false
    }

    constructor(props) {
        super(props);
    }
    componentWillMount(){
    }
    render() {
        let { medicalkit, isTop, fcColor, isSignin } = this.props;
        return (
            <View className={`pl-3-5 pr-3-5 pt-1-5 ft26  bg_fff  ov_h ${isTop ? 'mt-2-5 bdr_10' :'' }`}>
                <View className='flex flex-r flex-item-between '>
                    <Text className='pb-3-5 pt-2'>药品概况：</Text>
                    <View className='flex flex-r flex-item-center pb-3-5 pt-2 pl-2' onClick={() => {
                        // Taro.reLaunch({
                        //     url: '/pages/index/index',
                        //     success: ()=> {
                        //         setTimeout(()=>{
                                    Taro.navigateTo({
                                        url: `/pages/drugAdministration/index?medicalkitid=${medicalkit.MedicalkitID || medicalkit.bdid || medicalkit.medicalkitid}${isSignin ? `&SigninId=${medicalkit.id}`:``}`
                                    })
                        //         },300)
                        //     }
                        // })
                        }}
                    >
                        <View style={{ color: '#868B9C' }}  >详情</View>
                        <Image className='ml-0-5' style={{ width: Taro.pxTransform(12), height: Taro.pxTransform(22), opacity: 0.6 }} src={require('../../assets/imgs/home/home_icon_pressed.png')} />
                    </View>
                </View>
                <View className={`pl-5-5 ov_h mb-2-5 ${fcColor}`}>
                    <View className='mb-2-5'>① 药品种类：{medicalkit.countClass}类</View>
                    <View className='mb-2-5'>② 药品总数：{medicalkit.countAll}只</View>
                    <View className='mb-2-5'>③ <Text className='fc_960'>近效期药品：{medicalkit.countValidity}只</Text></View>
                    <View className='mb-2-5'>④ 药品使用：{medicalkit.countUse}只</View>
                </View>
                {this.props.renderSolt}
            </View>
        )
    }
}

Sunrvey.propTypes = {
    medicalkit: PropTypes.object,
    renderSolt: PropTypes.string,
    isTop: PropTypes.bool,
    fcColor: PropTypes.string,
    entranceType: PropTypes.number
}